<%@page import="com.netistate.pojo.Demo"%>
<%@page import="com.netistate.pojo.Product"%>
<%@page import="com.netistate.pojo.Project"%>
<%@page import="com.netistate.pojo.User"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String id = (String)request.getSession().getAttribute("projectid"); %>
<div class="minWin">
   <form id="myForm" action="#" method="post">
	<table id="addServiceTable" width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="bg_color_common" style="font-size: 12">
	<thead>
		<input type="hidden" name="pid" id="pid" value="<%=id%>"/>
		<%
	        Date date = new Date();
		    SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
		    String supporDate = sdFormat.format(date);
		    Calendar calendar = Calendar.getInstance();
		    calendar.setTime(date);
		 %>
		<tr>
			<td title="提供服务日期" align="right">提供服务日期：</td>
			<td >
				<input type="text" readonly="readonly" id="supportDate" value="<%=supporDate %>" class="input3" onclick="MyCalendar.SetDate(this)" style="width: 100px" name="day" >
				<span title="用了">用了</span>
				<input type="text" style="width: 50px" id="hours">
				<span title="小时">小时</span>
				<span style="color:red">*</span>
				<span style="color:red">
					<input id="intoLabor" type="checkbox" value="1"/>勾选后自动录入工时表
				</span>
			</td>
		</tr>
		<tr>
			<td title="我方人员" align="right">我方人员：
			</td>
			<td>
				<% User u = (User)request.getSession().getAttribute("session_user");
				   List<User> userList = (List<User>)request.getSession().getAttribute("userList");
					for(User r : userList){ %>				
		   			<span style="display:inline;width:60px">
			   			<input type="checkbox" name="ourPeople" <%=r.getRealName().equals(u.getRealName()) ? "checked" : "" %> name="ourPeople" value="<%=r.getRealName() %>" /><%=r.getRealName() %>
			   		</span>
			   		<%} %>
			</td>
		</tr>
		<tr>
			<td title="他方人员" align="right">他方人员：
			</td>
			<td>
				<input type="text" name="" id="otherPeople"/>
				<span style="color:red">*</span>
				<span style="color:red">
					<input id="intoClientContact" type="checkbox" value="1"/>勾选后自动录入客户联系表
				</span>
			</td>
		</tr>
		<tr>
			<td title="服务方式" align="right">服务方式：</td>
			<td>
				<select id="serviceType" name="serviceType">
                   <option value="客户现场">客户现场</option>
				   <option value="远程支持">远程支持</option>
				   <option value="电话会议">电话会议</option>
				   <option value="公司会议">公司会议</option>
				   <option value="其他">其他</option>
				</select>
			</td>
		</tr>
		<tr>
			<td title="支持地点" align="right">支持地点：
			</td>
			<td style="width:100%" >
				<input style="width:70%" type="text" name="address" id="address"/>
			</td>
		</tr>
		<tr>
			<td title="销售表类型" align="right">服务记录类型：
			</td>
			<td>
				<select id="selectServiceType" onchange="onChangeService()" >
					<option value="">请选择服务记录类型</option>
				   	<option value="s1">现场售后服务</option>
				   	<option value="s2">现场实施服务</option>
				   	<option value="s3">现场售前测试(POC)</option>
				   	<!-- <option value="s4">系统升级服务</option> -->
				   	<option value="s5">售前交流</option>
				   	<option value="s6">会议纪要</option>
				   	<option value="s7">文档编写</option>
				   	<option value="s8">客户拜访</option>
				</select>
				<span id="showProductMsg" style="display:none;color:red" >
					<input id="showProductMsgInput" onclick="checkedShowPDMsg()" type="checkbox" value="1"/>勾选后显示产品信息
				</span>
				<span id="showDemoMsg" style="display:none;color:red" >
					<input id="showDemoMsgInput" onclick="checkedShowDemoMsg(<%=id %>)" type="checkbox" value="1"/>勾选后显示Demo信息
				</span>
			</td>
		</tr>
		</thead>
		<!-- 这里是关于Demo的信息 -->
		<tbody id="showDemoContent" style="display:none;color:#CB5013">
			<%	Project pd = (Project)request.getSession().getAttribute("selectProjectInSale"); 
				Set<Demo> demoList = (Set<Demo>)pd.getDemoSet();
				if(demoList.size() == 0){%>
			<tr>
				<td title="Demo机信息" style="color:#CB5013" align="right">Demo机信息：</td>
				<td style="width:100%;color:#CB5013" >无Demo信息
					<input type="hidden" id="noProduct" value="1"/>
				</td>
			</tr>
			<%} else { 
			for(Demo d : demoList){%>
			<tr >
				<td title="Demo机名称和型号" align="right">Demo机名称和型号：</td>
				<td style="width:100%" >
					<input type="hidden" id="noProduct" value="1"/>
					<input style="width:70%;color:#CB5013" disabled type="text" id="PSproduct" value="<%=d.getSeqNo()%>"/>
				</td>
			</tr>
			<%} }%>
			
		</tbody>
		<!-- 这里是关于产品的信息 -->
		<tbody id="showPDMsg" style="display:none;color:#CB5013">
			<%	Project p = (Project)request.getSession().getAttribute("selectProjectInSale"); 
			  	Set<Product> productList = (Set<Product>)p.getProductList();
			  	if(productList.size() == 0){%>
		  	<tr >
				<td title="无产品" style="color:#CB5013" align="right">产品信息：</td>
				<td style="width:100%;color:#CB5013" >无产品信息
					<input type="hidden" id="noProduct" value="1"/>
				</td>
			</tr>
			<%  } else {
				for(Product pp : productList){ %>
			<tr >
				<td title="产品名称和型号" align="right">产品名称和型号：</td>
				<td style="width:100%" >
					<input type="hidden" id="noProduct" value="1"/>
					<input type="hidden" id="PSproductId" value="<%=pp.getId()%>"/>
					<input style="width:70%;color:#CB5013" type="text" id="PSproduct" value="<%=pp.getProduct()%>"/>
				</td>
			</tr>
			<tr >
				<td title="产品IP" align="right">产品IP：</td>
				<td style="width:100%" >
					<input style="width:70%;color:#CB5013" type="text" id="PSproductIp" value="<%=pp.getIp()%>"/>
				</td>
			</tr>
			<tr >
				<td title="DNS" align="right">DNS：</td>
				<td style="width:100%" >
					<input style="width:70%;color:#CB5013" type="text" id="PSproductDNS" value="<%=pp.getDns()%>"/>
				</td>
			</tr>
			<tr >
				<td title="网关" align="right">网关：</td>
				<td style="width:100%" >
					<input style="width:70%;color:#CB5013" type="text" id="PSproductGetway" value="<%=pp.getGateway()%>"/>
				</td>
			</tr>
			<%} }%>
		</tbody>
		<%-- <tr id="i1" style="display:none">
			<td title="支持日期" align="right">支持日期:
			</td>
			<td>
			    <input id="supportDate" name="supportDate" type="text" style="width:80px" onclick="MyCalendar.SetDate(this)" value="<%=supporDate %>" readonly="readonly" />
			</td>
		</tr>
		<tr id="i2" style="display:none">
			<td title="预计达到目标" align="right">预计达到目标:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="goal"></textarea>
			</td>
		</tr>
		<tr id="i3" style="display:none">
			<td title="客户关注内容" align="right">客户关注内容:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="focusContent"></textarea>
			</td>
		</tr>
		<tr id="i4" style="display:none">
			<td title="下一步工作计划" align="right">下一步工作计划:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="nextStep"></textarea>
			</td>
		</tr>
		<tr id="i5" style="display:none">
			<td title="对手动态及信息" align="right">对手动态及信息:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="rivalMsg"></textarea>
			</td>
		</tr>
		<tr id="i6" style="display:none">
			<td title="对项目的建议和想法" align="right">对项目的建议和想法:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="idea"></textarea>
			</td>
		</tr>
		
		<tr id="i7" style="display:none">
			<td title="工作内容" align="right">工作内容:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="workContent"></textarea>
			</td>
		</tr>
		
		<tr id="i8" style="display:none">
			<td title="遗留问题" align="right">遗留问题:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="leftProblem"></textarea>
			</td>
		</tr>
		
		<tr id="i8" style="display:none">
			<td title="工作记录和备注" align="right">工作记录和备注:
			</td>
			<td>
				<textarea rows="3" cols="44" name="" id="workNote"></textarea>
			</td>
		</tr> --%>
		
		<c:forEach var="pl" items="${sessionScope.projectList }">
			<input type="hidden" id="projectNameList" name="projectNameList" value="${pl.projectName }"/>
		</c:forEach>
		
	</table>
	</form>
	
	<script type="text/javascript">
	
		
		
		 function dateEnable(){
			var begintime = document.getElementById("begintime").value;
			var endtime = document.getElementById("endtime").value;
			alert(begintime);
			if(begintime>endtime){
				PigossMsg.alert("开始时间必须小于结束时间！");
			}
		};
		
		function selectType(){
			var test = document.getElementById("saletype").value;
			if(test == "客户现场服务"){
				var sd = document.getElementById("trSupportDate");
				sd.style.display='block';
			};
		
		};
		
	</script>
	
</div>
